from flask import Flask, request, render_template
from datetime import timedelta


app = Flask(__name__)

app.config["template_folder"] = "templates"

# 设置默认缓存时间
app.config["SEND_FILE_MAX_AGE_DEFAULT"] = timedelta(seconds=1)

@app.route("/", methods=["get", "post"])
def index():
    r = request
    if request.method == "POST":
        print(r.files.get("image_file").stream.read())
        print(r.files.get("image_file").name)
        print(r.files.get("image_file").filename)
        print(r.files.get("image_file").content_length)
        print(r.files.get("image_file").content_type)
        print(r)
    return render_template("file.html")


if __name__ == '__main__':
    app.run(debug=True, port=80)